home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
numerico.zip
/
NUMERIC.C
< prev
Wrap
Text File
|
1993-04-06
|
38KB
|
1,059 lines
/* *******************************************************************
* Function name : d_convert(string)
*
* Description : This function converts a character string number
* into the actual numerical value. This value,
* then being placed in a double floating point
* variable.
*
* Variables : string - This variable is the vehicle used to
* receive the character string sent by the
* calling function.
*
* count - This variable is used to assist in loop
* control
*
* sign - This variable is set to 1 at the onset of
* the function. Then, if a negative sign is
* encountered in the number, "sign" is set
* to a value of -1. Finally, just prior to
* returning a numeric value, this value is
* multiplied by sign. This, if a negative sign
* was encountered, than the multiplication by
* -1 would make the returned value negative.
*
* digit - "digit" contains the individual character
* values to be converted.
*
* period - This variable tracts the location of the
* decimal point.
*
* Examples : char ascii_number[] = "123.45";
* double output, d_convert();
* output = d_convert(ascii_number);
*
* Rules : Non-numeric values are ignored, thus the value 12z3
* is converted as 123.
*
* The negative sign may be at either the beginning of
* ending of the input number.
*
* The function name "d_convert" must be defined as a
* "double" within the calling function.
*
*/
double d_convert(string)
char string[];
{ int count, sign, digit, period;
double amount, point;
count = 0;
sign = 1;
while (string[count] )
if (string[count++] == '-' ) sign = -1;
count = amount = period = 0; point = 1;
while ( string[count] )
{ if ( string[count] == '.' ) period = 1;
if ( string[count] >= '0' && string[count] <= '9' )
{ digit = string[count] - '0';
amount *= 10;
amount += digit;
if ( period == 1 ) point *= .1;
}
count++;
}
amount *= point;
amount *= sign;
return(amount);
}
/* *******************************************************************
* Function name : f_convert(string)
*
* Description : This function converts a character string number
* into the actual numerical value. This value,
* then being placed in a floating point variable.
*
* Variables : string - This variable is the vehicle used to
* receive the character string sent by the
* calling function.
*
* count - This variable is used to assist in loop
* control
*
* sign - This variable is set to 1 at the onset of
* the function. Then, if a negative sign is
* encountered in the number, "sign" is set
* to a value of -1. Finally, just prior to
* returning a numeric value, this value is
* multiplied by sign. This, if a negative sign
* was encountered, than the multiplication by
* -1 would make the returned value negative.
*
* digit - "digit" contains the individual character
* values to be converted.
*
* period - This variable tracts the location of the
* decimal point.
*
* Examples : char ascii_number[] = "123.45";
* float output, f_convert();
* output = f_convert(ascii_number);
*
* Rules : Non-numeric values are ignored, thus the value 12z3
* is converted as 123.
*
* The negative sign may be at either the beginning of
* ending of the input number.
*
* The function name "f_convert" must be defined as a
* "float" within the calling function.
*
*/
float f_convert(string)
char string[];
{ int count, sign, digit, period;
float amount, point;
count = 0;
sign = 1;
while (string[count] )
if (string[count++] == '-' ) sign = -1;
count = amount = period = 0;
point = 1; while ( string[count] )
{ if ( string[count] == '.' ) period = 1;
if ( string[count] >= '0' && string[count] <= '9' )
{ digit = string[count] - '0';
amount *= 10;
amount += digit;
if ( period == 1 ) point *= .1;
}
count++;
}
amount *= point;
amount *= sign;
return(amount);
}
/* *******************************************************************
* Function name : i_convert(string)
*
* Description : This function converts a character string number
* into the actual numerical value. This value,
* then being placed in an integer variable.
*
* Variables : string - This variable is the vehicle used to
* receive the character string sent by the
* calling function.
*
* count - This variable is used to assist in loop
* control
*
* sign - This variable is set to 1 at the onset of
* the function. Then, if a negative sign is
* encountered in the number, "sign" is set
* to a value of -1. Finally, just prior to
* returning a numeric value, this value is
* multiplied by sign. This, if a negative sign
* was encountered, than the multiplication by
* -1 would make the returned value negative.
*
* digit - "digit" contains the individual character
* values to be converted.
*
* Examples : char ascii_number[] = "123.45";
* int output, f_convert();
* output = i_convert(ascii_number);
*
* Rules : Non-numeric values are ignored, thus the value 12z3
* is converted as 123.
*
* The negative sign may be at either the beginning of
* ending of the input number.
*
* The function name "i_convert" may optionally be
* defined as an integer within the calling function.
*
* Decimal points are ignored.
*/
i_convert(string)
char string[];
{ int count, sign, amount, digit;
count = 0;
sign = 1;
while (string[count] )
if (string[count++] == '-' ) sign = -1;
count = amount = 0;
while ( string[count] )
{ if ( string[count] >= '0' && string[count] <= '9' )
{ digit = string[count] - '0';
amount *= 10;
amount += digit;
}
count++;
}
amount *= sign;
return(amount);
}
/* *******************************************************************
* Function name : lpr_char(x, y, string, outstring)
*
* Description : This function facilitates the input of ASCII
* character strings. Additionally, prior the to actual
* input, the cursor is placed at a specified screen
* location and a prompt is displayed.
*
* Variables : string - This variable is the vehicle used to
* receive the prompt that is displayed
* on the screen
*
* x - This parameter defines the horizontal
* row on which the cursor will be placed.
* Consider "x" to be the "x" part of an
* "x,y" axis.
*
* y - This parameter defines the vertical
* column on which the cursor will be placed.
* Consider "y" to be the "y" part of an
* "x,y" axis.
*
* outstring - This variable contains the ASCII character
* character string input by the user.
*
*
* Examples : char ascii_value[10];
* lpr_char(10,5,"Enter employee name : ",ascii_value);
*
* Rules : Any ASCII characters can be entered.
*
* The "x" value must be between 1 and 24
*
* The "y" value must be between 1 and 80
*
*/
lpr_char(x,y,string,out_string)
int x,y;
char string[], *out_string;
{ printf("%c[%d;%dH",'\33',x,y);
printf("%s",string);
gets(out_string);
}
/* *******************************************************************
* Function name : lpr_double(x, y, string)
*
* Description : This function facilitates the input of double floating
* point number. Additionally, prior the to actual
* input, the cursor is placed at a specified screen
* location and a prompt is displayed.
*
* Variables : string - This variable is the vehicle used to
* receive the prompt that is displayed
* on the screen
*
* x - This parameter defines the horizontal
* row on which the cursor will be placed.
* Consider "x" to be the "x" part of an
* "x,y" axis.
*
* y - This parameter defines the vertical
* column on which the cursor will be placed.
* Consider "y" to be the "y" part of an
* "x,y" axis.
*
*
* Examples : double output, lpr_double();
* output = lpr_double(10,5,"Enter employee name : ");
*
* Rules : Non-numeric values are ignored, thus the value 12z3
* is converted as 123.
*
* The negative sign may be at either the beginning of
* ending of the input number.
*
* The function name "lpr_double" must be defined
* as a double floating point number within the
* calling function.
*
* The "x" value must be between 1 and 24
*
* The "y" value must be between 1 and 80
*
*/
double lpr_double(x,y,string)
int x,y;
char string[];
{ double out_num, d_convert();
char in_num[15];
printf("%c[%d;%dH",'\33',x,y);
printf("%s",string);
gets(in_num);
out_num = d_convert(in_num);
return(out_num);
}
/* *******************************************************************
* Function name : lpr_float(x, y, string)
*
* Description : This function facilitates the input of floating
* point number. Additionally, prior the to actual
* input, the cursor is placed at a specified screen
* location and a prompt is displayed.
*
* Variables : string - This variable is the vehicle used to
* receive the prompt that is displayed
* on the screen
*
* x - This parameter defines the horizontal
* row on which the cursor will be placed.
* Consider "x" to be the "x" part of an
* "x,y" axis.
*
* y - This parameter defines the vertical
* column on which the cursor will be placed.
* Consider "y" to be the "y" part of an
* "x,y" axis.
*
*
* Examples : float output, lpr_float();
* output = lpr_float(10,5,"Enter employee name : ");
*
* Rules : Non-numeric values are ignored, thus the value 12z3
* is converted as 123.
*
* The negative sign may be at either the beginning of
* ending of the input number.
*
* The function name "lpr_float" must be defined
* as a double floating point number within the
* calling function.
*
* The "x" value must be between 1 and 24
*
* The "y" value must be between 1 and 80
*
*/
float lpr_float(x,y,string)
int x,y;
char string[];
{ float out_num, f_convert();
char in_num[15];
printf("%c[%d;%dH",'\33',x,y);
printf("%s",string);
gets(in_num);
out_num = f_convert(in_num);
return(out_num);
}
/* *******************************************************************
* Function name : lpr_g_response(x, y, string)
*
* Description : This function facilitates the input of a keyboard
* response. Additionally, prior the to actual
* input, the cursor is placed at a specified screen
* location and a prompt is displayed.
*
* Variables : string - This variable is the vehicle used to
* receive the prompt that is displayed
* on the screen
*
* x - This parameter defines the horizontal
* row on which the cursor will be placed.
* Consider "x" to be the "x" part of an
* "x,y" axis.
*
* y - This parameter defines the vertical
* column on which the cursor will be placed.
* Consider "y" to be the "y" part of an
* "x,y" axis.
*
*
* Examples : lpr_g_response(10,5,"Hit any key to continue : ");
*
* Rules : The value input is ignored.
*
* The function return control to the colling modual as
* as soon as a any keyboard character is pressed.
*
* The "x" value must be between 1 and 24
*
* The "y" value must be between 1 and 80
*
*/
lpr_g_response(x,y,string)
int x,y;
char string[];
{ char *out_string;
printf("%c[%d;%dH",'\33',x,y);
printf("%s",string);
getch(out_string);
}
/* *******************************************************************
* Function name : lpr_g_yes_no(x, y, x_error, y_error, string,
* e_string, out_string)
*
* Description : This function facilitates the input of a "y" or
* "n" value. Additionally, prior the to actual
* input, the cursor is placed at a specified screen
* location and a prompt is displayed. Also, if an
* invalid response is entered, an error message is
* displayed at a user defined screen location.
*
* Variables : string - This variable is the vehicle used to
* receive the prompt that is displayed
* on the screen
*
* x - This parameter defines the horizontal
* row on which the cursor will be placed.
* Consider "x" to be the "x" part of an
* "x,y" axis.
*
* y - This parameter defines the vertical
* column on which the cursor will be placed.
* Consider "y" to be the "y" part of an
* "x,y" axis.
*
* x_error - This parameter defines the horizontal
* row at which the error message is displayed.
* Consider "x" to be the "x" part of an
* "x,y" axis.
*
* y - This parameter defines the vertical
* column at which the error message is displayed.
* Consider "y" to be the "y" part of an
* "x,y" axis.
*
* e_string - This variable is used to pass the error
* message that will be displayed if an invalid
* response is entered.
*
* out_string - "out_string" contains the yes or no response
* that is returned to the calling function.
*
* Examples : char reply[2];
* lpr_g_yes_no(5,5,25,5,"Enter Y or N","ERROR, reenter",
* out_string);
*
* Rules : The reply must be "y", "n", "Y", or "N"
*
* The "x" and "x_error" values must be between 1 and 24
*
* The "y" and "y_error" values must be between 1 and 80
*
*/
lpr_g_yes_no(x,y,x_error,y_error,string,e_string,out_string)
int x,y,x_error,y_error;
char string[], e_string[], *out_string;
{ do
{ printf("%c[%d;%dH",'\33',x,y);
printf("%s",string);
gets(out_string);
if ( *out_string != 'n' && *out_string != 'N' &&
*out_string != 'y' && *out_string != 'Y' )
{ printf("%c[%d;%dH",'\33',x_error,y_error);
printf("%s",e_string);
}
} while ( *out_string != 'n' && *out_string != 'N' &&
*out_string != 'y' && *out_string != 'Y' );
}
/* *******************************************************************
* Function name : lpr_integer(x, y, string)
*
* Description : This function facilitates the input of integer
* numbers. Additionally, prior the to actual
* input, the cursor is placed at a specified screen
* location and a prompt is displayed.
*
* Variables : string - This variable is the vehicle used to
* receive the prompt that is displayed
* on the screen
*
* x - This parameter defines the horizontal
* row on which the cursor will be placed.
* Consider "x" to be the "x" part of an
* "x,y" axis.
*
* y - This parameter defines the vertical
* column on which the cursor will be placed.
* Consider "y" to be the "y" part of an
* "x,y" axis.
*
*
* Examples : int output, lpr_intenger;
* output = lpr_integer(10,5,"Enter employee name : ");
*
* Rules : Non-numeric values are ignored, thus the value 12z3
* is converted as 123.
*
* The negative sign may be at either the beginning of
* ending of the input number.
*
* The function name "lpr_integer" may be optionally
* defined as an integer number within the calling
* function.
*
* The "x" value must be between 1 and 24
*
* The "y" value must be between 1 and 80
*
* Decimal points are ignored.
*/
lpr_integer(x,y,string)
int x,y;
char string[];
{ int out_num, i_convert();
char in_num[15];
printf("%c[%d;%dH",'\33',x,y);
printf("%s",string);
gets(in_num);
out_num = i_convert(in_num);
return(out_num);
}
/* *******************************************************************
* Function name : l_char(x, y, out_string)
*
* Description : This function facilitates the input of ASCII
* character strings. Additionally, prior the to actual
* input, the cursor is placed at a specified screen
* location.
*
* variables : x - This parameter defines the horizontal
* row on which the cursor will be placed.
* Consider "x" to be the "x" part of an
* "x,y" axis.
*
* y - This parameter defines the vertical
* column on which the cursor will be placed.
* Consider "y" to be the "y" part of an
* "x,y" axis.
*
* out_string - This variable contains the ASCII character
* character string input by the user.
*
*
* Examples : char ascii_value[10];
* l_char(10,5,ascii_value);
*
* Rules : Any ASCII characters can be entered.
*
* The "x" value must be between 1 and 24
*
* The "y" value must be between 1 and 80
*
*/
l_char(x,y,out_string)
int x,y;
char *out_string;
{ printf("%c[%d;%dH",'\33',x,y);
gets(out_string);
}
/* *******************************************************************
* Function name : l_double(x,y)
*
* Description : This function facilitates the input of double floating
* point number. Additionally, prior the to actual
* input, the cursor is placed at a specified screen
* location.
*
* Variables : x - This parameter defines the horizontal
* row on which the cursor will be placed.
* Consider "x" to be the "x" part of an
* "x,y" axis.
*
* y - This parameter defines the vertical
* column on which the cursor will be placed.
* Consider "y" to be the "y" part of an
* "x,y" axis.
*
*
* Examples : double output, l_double();
* output = l_double(10,5);
*
* Rules : Non-numeric values are ignored, thus the value 12z3
* is converted as 123.
*
* The negative sign may be at either the beginning of
* ending of the input number.
*
* The function name "l_double" must be defined
* as a double floating point number within the
* calling function.
*
* The "x" value must be between 1 and 24
*
* The "y" value must be between 1 and 80
*
*/
double l_double(x,y)
int x,y;
{ double out_num, d_convert();
char in_num[15];
printf("%c[%d;%dH",'\33',x,y);
gets(in_num);
out_num = d_convert(in_num);
return(out_num);
}
/* *******************************************************************
* Function name : l_float(x,y)
*
* Description : This function facilitates the input of floating
* point number. Additionally, prior the to actual
* input, the cursor is placed at a specified screen
* location.
*
* Variables : x - This parameter defines the horizontal
* row on which the cursor will be placed.
* Consider "x" to be the "x" part of an
* "x,y" axis.
*
* y - This parameter defines the vertical
* column on which the cursor will be placed.
* Consider "y" to be the "y" part of an
* "x,y" axis.
*
*
* Examples : float output, l_float();
* output = l_float(10,5);
*
* Rules : Non-numeric values are ignored, thus the value 12z3
* is converted as 123.
*
* The negative sign may be at either the beginning of
* ending of the input number.
*
* The function name "l_float" must be defined
* as a double floating point number within the
* calling function.
*
* The "x" value must be between 1 and 24
*
* The "y" value must be between 1 and 80
*
*/
float l_float(x,y)
int x,y;
{ float out_num, f_convert();
char in_num[15];
printf("%c[%d;%dH",'\33',x,y);
gets(in_num);
out_num = f_convert(in_num);
return(out_num);
}
/* *******************************************************************
* Function name : l_g_response(x,y)
*
* Description : This function facilitates the input of a keyboard
* response. Additionally, prior the to actual
* input, the cursor is placed at a specified screen
* location.
*
* Variables : x - This parameter defines the horizontal
* row on which the cursor will be placed.
* Consider "x" to be the "x" part of an
* "x,y" axis.
*
* y - This parameter defines the vertical
* column on which the cursor will be placed.
* Consider "y" to be the "y" part of an
* "x,y" axis.
*
*
* Examples : l_g_response(10,5);
*
* Rules : The value input is ignored.
*
* The function return control to the calling modual as
* as soon as a any keyboard character is pressed.
*
* The "x" value must be between 1 and 24
*
* The "y" value must be between 1 and 80
*
*/
l_g_response(x,y)
int x,y;
{ char *out_string;
printf("%c[%d;%dH",'\33',x,y);
getch(out_string);
}
/* *******************************************************************
* Function name : l_g_yes_no(x, y, x_error, y_error, e_string,
* out_string)
*
* Description : This function facilitates the input of a "y" or
* "n" value. Additionally, prior the to actual
* input, the cursor is placed at a specified screen
* location and a prompt is displayed. Also, if an
* invalid response is entered, an error message is
* displayed.
*
* Variables : x - This parameter defines the horizontal
* row on which the cursor will be placed.
* Consider "x" to be the "x" part of an
* "x,y" axis.
*
* y - This parameter defines the vertical
* column on which the cursor will be placed.
* Consider "y" to be the "y" part of an
* "x,y" axis.
*
* x_error - This parameter defines the horizontal
* row at which the error message is displayed.
* Consider "x" to be the "x" part of an
* "x,y" axis.
*
* y - This parameter defines the vertical
* column at which the error message is displayed.
* Consider "y" to be the "y" part of an
* "x,y" axis.
*
* e_string - This variable is used to pass the error
* message that will be displayed if an invalid
* response is entered.
*
* out_string - "out_string" contains the yes or no response
* that is returned to the calling function.
*
* Examples : char reply[2];
* l_g_yes_no(5,5,25,5,"ERROR, reenter", out_string);
*
* Rules : The reply must be "y", "n", "Y", or "N"
*
* The "x" and "x_error" values must be between 1 and 24
*
* The "y" and "y_error" values must be between 1 and 80
*
*/
l_g_yes_no(x, y, x_error, y_error, e_string, out_string)
int x,y,x_error,y_error;
char e_string[], *out_string;
{ do
{ printf("%c[%d;%dH",'\33',x,y);
gets(out_string);
if ( *out_string != 'n' && *out_string != 'N' &&
*out_string != 'y' && *out_string != 'Y' )
{ printf("%c[%d;%dH",'\33',x_error,y_error);
printf("%s",e_string);
}
} while ( *out_string != 'n' && *out_string != 'N' &&
*out_string != 'y' && *out_string != 'Y' );
}
/* *******************************************************************
* Function name : l_integer(x,y)
*
* Description : This function facilitates the input of integer
* numbers. Additionally, prior the to actual
* input, the cursor is placed at a specified screen
* location.
*
* Variables : x - This parameter defines the horizontal
* row on which the cursor will be placed.
* Consider "x" to be the "x" part of an
* "x,y" axis.
*
* y - This parameter defines the vertical
* column on which the cursor will be placed.
* Consider "y" to be the "y" part of an
* "x,y" axis.
*
*
* Examples : int output, l_intenger;
* output = l_integer(10,5);
*
* Rules : Non-numeric values are ignored, thus the value 12z3
* is converted as 123.
*
* The negative sign may be at either the beginning of
* ending of the input number.
*
* The function name "l_integer" may be optionally
* defined as an integer number within the calling
* function.
*
* The "x" value must be between 1 and 24
*
* The "y" value must be between 1 and 80
*
* Decimal points are ignored.
*/
l_integer(x,y,)
int x,y;
{ int out_num, i_convert();
char in_num[15];
printf("%c[%d;%dH",'\33',x,y);
gets(in_num);
out_num = i_convert(in_num);
return(out_num);
}
/* *******************************************************************
* Function name : pr_char(string, outstring)
*
* Description : This function facilitates the input of ASCII
* character strings. Additionally, prior to the
actual input, a specified prompt is displayed.
*
* Variables : string - This variable is the vehicle used to
* receive the prompt that is displayed
* on the screen
*
* outstring - This variable contains the ASCII character
* character string input by the user.
*
*
* Examples : char ascii_value[10];
* pr_char("Enter employee name : ",ascii_value);
*
* Rules : Any ASCII characters can be entered.
*
*/
pr_char(string,out_string)
char string[], *out_string;
{ printf("%s",string);
gets(out_string);
}
/* *******************************************************************
* Function name : pr_double(string)
*
* Description : This function facilitates the input of double floating
* point number. Additionally, prior the to actual
* input, a specified prompt is displayed.
*
* Variables : string - This variable is the vehicle used to
* receive the prompt that is displayed
* on the screen
*
* Examples : double output, pr_double();
* output = lpr_double("Enter employee name : ");
*
* Rules : Non-numeric values are ignored, thus the value 12z3
* is converted as 123.
*
* The negative sign may be at either the beginning of
* ending of the input number.
*
* The function name "pr_double" must be defined
* as a double floating point number within the
* calling function.
*
*/
double pr_double(string)
char string[];
{ double out_num, d_convert();
char in_num[15];
printf("%s",string);
gets(in_num);
out_num = d_convert(in_num);
return(out_num);
}
/* *******************************************************************
* Function name : pr_float(string)
*
* Description : This function facilitates the input of floating
* point number. Additionally, prior the to actual
* input, a specified prompt is displayed.
*
* Variables : string - This variable is the vehicle used to
* receive the prompt that is displayed
* on the screen
*
* Examples : float output, pr_float();
* output = pr_float("Enter employee name : ");
*
* Rules : Non-numeric values are ignored, thus the value 12z3
* is converted as 123.
*
* The negative sign may be at either the beginning of
* ending of the input number.
*
* The function name "pr_float" must be defined
* as a double floating point number within the
* calling function.
*
*/
float pr_float(string)
char string[];
{ float out_num, f_convert();
char in_num[15];
printf("%s",string);
gets(in_num);
out_num = f_convert(in_num);
return(out_num);
}
/* *******************************************************************
* Function name : pr_g_response(string)
*
* Description : This function facilitates the input of a keyboard
* response. Additionally, prior the to actual
* input, a specified prompt is displayed.
*
* Variables : string - This variable is the vehicle used to
* receive the prompt that is displayed
* on the screen
*
*
* Examples : pr_g_response("Hit any key to continue : ");
*
* Rules : The value input is ignored.
*
* The function return control to the colling modual as
* as soon as a any keyboard character is pressed.
*
*/
pr_g_response(string)
char string[];
{ char *out_string;
printf("%s",string);
getch(out_string);
}
/* *******************************************************************
* Function name : pr_g_yes_no(string, e_string, out_string)
*
* Description : This function facilitates the input of a "y" or
* "n" value. Additionally, prior the to actual
* input, a specified prompt is displayed. Also, if an
* invalid response is entered, an error message is
* displayed.
*
* Variables : string - This variable is the vehicle used to
* receive the prompt that is displayed
* on the screen
*
* e_string - This variable is used to pass the error
* message that will be displayed if an invalid
* response is entered.
*
* out_string - "out_string" contains the yes or no response
* that is returned to the calling function.
*
* Examples : char reply[2];
* pr_g_yes_no("Enter Y or N","ERROR, reenter",out_string);
*
* Rules : The reply must be "y", "n", "Y", or "N"
*
*/
pr_g_yes_no(string,e_string,out_string)
char string[], e_string[], *out_string;
{ do
{ printf("%s",string);
gets(out_string);
if ( *out_string != 'n' && *out_string != 'N' &&
*out_string != 'y' && *out_string != 'Y' )
{ printf("\n%s",e_string);
}
} while ( *out_string != 'n' && *out_string != 'N' &&
*out_string != 'y' && *out_string != 'Y' );
}
/* *******************************************************************
* Function name : pr_integer(string)
*
* Description : This function facilitates the input of integer
* numbers. Additionally, prior the to actual
* input, a specified prompt is displayed.
*
* Variables : string - This variable is the vehicle used to
* receive the prompt that is displayed
* on the screen
*
* "x,y" axis.
*
* Examples : int output, pr_intenger;
* output = pr_integer("Enter employee name : ");
*
* Rules : Non-numeric values are ignored, thus the value 12z3
* is converted as 123.
*
* The negative sign may be at either the beginning of
* ending of the input number.
*
* The function name "pr_integer" may be optionally
* defined as an integer number within the calling
* function.
*
* Decimal points are ignored.
*/
pr_integer(string)
char string[];
{ int out_num, i_convert();
char in_num[15];
printf("%s",string);
gets(in_num);
out_num = i_convert(in_num);
return(out_num);
}